<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>收起，更多</title>
    <style>
        ul{
           list-style: none;
        }
        button{
            margin-left: 20px;
        }
    </style>
</head>
<body>
    <ul>
        <li>小米</li>
        <li>华为</li>
        <li>苹果</li>
        <li>oppo</li>
        <li>三星</li>
        <li>更多品牌</li>
    </ul>
    <button>更多</button>
    <script src="jquery-1.11.3.min.js"></script>
    <script>
        //显示小于2 的排除最后一个
        // $("ul li:gt(2):not(:last)").css("display","none");
        var str=$("ul li:gt(2):not(:last)");
            str.css("display","none");
        $("button").click(function(){
          
            if(str.is(":visible")){
                // is用来做检测
                str.css("display","none");
                $("button").text("显示")
            }
            else{
                str.css("display","block");
                $("button").text("收起")
            }

            

        })
    </script>
</body>
</html>